import React from 'react';
import { Button } from 'antd';
import './../index.scss';

class ImportData extends React.PureComponent {
  constructor(props) {
    super(props);
    this.state = {
      fileName: props.fileName || '',
    };
    this.downLoad = ::this.downLoad;
  }
  downLoad() {
    const { fileName } = this.state;
    window.open(`static/${fileName}`);
  }
  render() {
    return (
      <div>
        <Button onClick={this.downLoad} className="search-btn down-btn">
          <img src="images/icon_data_download.png" alt="下载" />
          下载模板
        </Button>
      </div>
    );
  }
}

export default ImportData;
